<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
            var data={
                name:"haha",
                age:11,
            }
            var url='./data/getData.text'
            function trueUrl(url,data){
                var tUrl=url+'?'
                for(let key in data){
                    tUrl+=key+"="+data[key]+'&'
                }
                // console.log(tUrl);
                tUrl=tUrl.slice(0,tUrl.length-1)
                return tUrl
            }
            console.log(trueUrl(url,data))
           




           
            // function trueUrl(url,data){
            //     var tUrl=[url+'?']
            //     for(let key in data){
            //         tUrl.push(key+'='+data[key])
            //     }
            //     console.log(tUrl);
            // }
          

    </script>
</body>
</html>